


cmake_minimum_required(VERSION 2.8.9)


set (NAME EasyView)
PROJECT(${NAME})

find_package(VTK REQUIRED)

include(${VTK_USE_FILE})

# use what QVTK built with
SET(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
SET(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
SET(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
FIND_PACKAGE(Qt5Widgets)
FIND_PACKAGE(Qt5Core)
FIND_PACKAGE(Qt5Gui)

# Use the include path and library for Qt that is used by VTK.
INCLUDE_DIRECTORIES(
  ${QT_INCLUDE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
)

include_directories(.)
include_directories("${PROJECT_SOURCE_DIR}")
include_directories("${PROJECT_SOURCE_DIR}/Qt")


# Set your files and resources here
SET(EasyViewSrcs main.cxx EasyView.cxx)
SET(EasyViewUI EasyView.ui)
SET(EasyViewHeaders EasyView.h)
SET(EasyViewResources Icons/icons.qrc)

# The rest should just work (sure...)
QT5_wrap_ui(UISrcs ${EasyViewUI})
QT5_wrap_cpp(MOCSrcs ${EasyViewHeaders} )
QT5_add_resources(ResourceSrcs ${EasyViewResources})

SOURCE_GROUP("Resources" FILES
  ${EasyViewUI}
  ${EasyViewResources}
  ${EXE_ICON}
)

SOURCE_GROUP("Generated" FILES
  ${UISrcs}
  ${MOCSrcs}
  ${ResourceSrcs}
  ${RCS_SOURCES}
)

ADD_DEFINITIONS(-DQT_GUI_LIBS -DQT_CORE_LIB -DQT3_SUPPORT)
SET_SOURCE_FILES_PROPERTIES(${EasyViewSrcs} PROPERTIES
                            OBJECT_DEPENDS "${UISrcs}")

# It's nice to have the ui in the windows project file...just double click on it
# and designer comes up on that ui file :)
IF (${CMAKE_BUILD_TOOL} MATCHES "msdev")
  SET (EasyViewSrcs ${EasyViewSrcs} ${EasyViewUI})
ENDIF (${CMAKE_BUILD_TOOL} MATCHES "msdev")
IF (${CMAKE_BUILD_TOOL} MATCHES "devenv")
  SET (EasyViewSrcs ${EasyViewSrcs} ${EasyViewUI})
ENDIF (${CMAKE_BUILD_TOOL} MATCHES "devenv")

ADD_EXECUTABLE( EasyView MACOSX_BUNDLE ${EasyViewSrcs} ${UISrcs} ${MOCSrcs} ${ResourceSrcs})

qt5_use_modules(${NAME} Core Gui Widgets)

TARGET_LINK_LIBRARIES( EasyView
  ${QT_LIBRARIES}
  ${VTK_LIBRARIES}
)